<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>光仪78同学会</title>
        <meta name="description" content="你的首页描述" />
        <meta name="keywords" content="你首页关键字" />
        <link rel="stylesheet" href="template/front/style.css" type="text/css" media="screen" />
        <script type="text/javascript" src="/resources/scripts/jquery-1.7.1.min.js"></script>
    </head>

    <body>
        <div id="fullwrapper">
            <div class="wrap">
                <div class="header">
                    <div class="logo">
                        <h3><a href="http://www.gy78.org">光仪78同学会</a>那个同学的美好时光</h3>
                    </div>
                    <div >
                        <ul id="topnav" class="nav">
                            <li id="menu-item-47" class=""><a href="/">首页</a></li>
                            <li id="menu-item-34" class=""><a href="<{spUrl c=main a=category id=1}>">文章</a></li>
                            <li id="menu-item-33" class=""><a href="<{spUrl c=main a=category id=2}>">照片</a></li>
                            <li id="menu-item-35" class=""><a href="<{spUrl c=main a=category id=3}>">诗人</a></li>
                            <li id="menu-item-50" class=""><a href="<{spUrl c=main a=page  id=13}>">关于</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="wrap">
                <div id="content" role="main">
                    <div class="content_top conleft"></div>
                    <div class="post" id="post-<{$post.id}>">
                        <h2><{$post.title}></h2>
                        <div class="post_intro"> <span>作者：<{$post.author}> 日期：<{$post.created}>  阅读：<{$post.count}>   </span> </div>
                        <div class="content_date">
                            <div class="datebg"> <span class="day"><{$post.created|date_format:"%d"}></span> <span><{$post.created|date_format:"%m"}></span> <span><{$post.created|date_format:"%Y"}></span> </div>
                        </div>
                        <div class="comments"> <span class="cmt_num"><a href="#comment-<{$comments['0']['comment_ID']}>" title="《<{$post.title}>》上的评论"><{$commentscount}></a></span> </div>
                        <div class="entry">
                            <p><{$post.text}></p>
                            <p>&nbsp;</p>
                        </div>
                        <h4 id="comments" class="clear"><{$commentscount}> 篇评论</h4>
                        <ol class="commentlist" id="commentlist">
                            <{foreach item=item from=$comments}>
                            <li class="comment  depth-1" id="comment-<{$item.comment_ID}>"   >
                                <div id="div-comment-<{$item.comment_ID}>" class="commentmetadata" style="margin-left:<{$item.level*30}>px;">
                                    <ul class="comminfo clear">
                                        <li><img src="template/front/images/tou.png" width="32" height="32" alt="" /></li>
                                        <li class="atxt"><span><{$item.screenname}></span><p>发表于<{$item.comment_date}></p></li>
                                    </ul>
                                    <ul  class="reply">
                                        <li>  <{if $userinfo eq true}><{if $userinfo.screenname eq $item.comment_author}><a class="comment-edit-link" href="#" title="编辑评论">编辑</a><{/if}><{/if}>
                                            <a  id="reply-<{$item.comment_ID}>" href='#comment-<{$item.comment_ID}>' onclick='return addCommentmoveForm("<{$item.comment_parent}>", "<{$item.comment_ID}>", "respond", "<{$item.comment_post_ID}>")'>回复</a>
                                            <a id="cancle-<{$item.comment_ID}>" href='#comment-<{$item.comment_ID}>' onclick='return cancleCommentmoveForm("0", "<{$item.comment_ID}>", "respond", "<{$item.comment_post_ID}>")' style="display:none">取消</a>
                                        </li>
                                    </ul>
                                    <ul class="commtext clear">
                                        <p><{$item.comment_content}></p>
                                    </ul>
                                </div>
                            </li>
                            <{/foreach}>
                        </ol>



                        <div id="respond">
                            <h4 class="clear">发表我的评论</h4>


                            <form action="" method="post" id="commentform">
                                <{if $userinfo eq true }>
                                <p class="smilies">当前您登录的用户名为 <{$userinfo.screenname}> </p>
                                <{else}>
                                <p class="smilies">您需要登录后发表评论 </p>
                                <{/if}>
                                <p><textarea name="comment_content" id="comment_content" cols="5" rows="10" tabindex="4" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('submit').click();return false};"></textarea></p>
                                <p><input name="submit" type="submit" id="submit" tabindex="5" class="subin" value="" />
                                    <input type='hidden' name='comment_post_ID' value='<{$id}>' id='comment_post_ID' />
                                    <input type='hidden' name='comment_parent' id='comment_parent' value='0' />
                                    <input type='hidden' name='comment_author' id='comment_author' value='<{$userinfo.name}>' />
                                </p>
                            </form>
                            <input type='hidden' name='logined' id='logined' value='<{if $userinfo eq true}>1<{else}>0<{/if}>' />
                            <input type='hidden' name='anchor' id='anchor' value='<{$anchor}>' />

                        </div>
                    </div>
                    <div class="content_foot conleft"></div>

                </div>
                <{include file="front/sidebar.html"}>
            </div>  	 <!-- end wrap  -->
            <{include file="front/footer.html"}>
        </div>


    </body>
</html>
<script type="text/javascript">
    $(document).ready(function(){
        window.location.hash='comment-'+$("#anchor").val();
        $("#submit").click(function(){
            if ($("#logined").val()==0)
            {	  			alert('您需要登录后才能发表评论！');
                return false;

            }

            if($.trim($("#comment_content").val())==''){
                alert('评论内容不能为空！');
                return false
            };
            $.post("<{spUrl c=main a=commentsave}>",$("#commentform").serialize(),function(msg){
                window.location.href='/index.php?c=main&a=article&id='+$("#comment_post_ID").val()+'&anchor='+$("#comment_parent").val();
                //		window.location.href=<{spUrl c=main a=article }>'comment-19';
            }
            ,'json');
            return false
        })	   ;

    });
    function addCommentmoveForm(comment_parent,comment_id,respond,post_id){
        $("a[id^='cancle-']").hide();
        $("a[id^='reply-']").show();
        $("#reply-"+comment_id).hide();
        $("#cancle-"+comment_id).show();
        $("#comment-"+comment_id).append($("#"+respond));
        $("#comment_post_ID").val(post_id);
        $("#comment_parent").val(comment_id)
    };
    function cancleCommentmoveForm(comment_parent,comment_id,respond,post_id){
        $("#reply-"+comment_id).show();
        $("#cancle-"+comment_id).hide();
        $("#commentlist").append($("#respond"));
        $("#comment_post_ID").val(post_id);
        $("#comment_parent").val(0)
    }
</script>
